package com.wx.common;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.validation.constraints.NotEmpty;
import java.util.Date;

@Data
@ApiModel(value = "baseEntity")
public class BaseEntity {
	/**
	 * 主键 id
	 */
	@ApiModelProperty(value = "主键")
	@Id
	@ExcelIgnore
	@NotEmpty(message = "id不能为空", groups = UpdateValidate.class)
	private String id;

	/**
	 * 版本号
	 */
	@Column(name = "version")
	@ApiModelProperty(value = "版本号")
	@ExcelIgnore
	private Integer version;

	/**
	 *删除标识
	 */
	@Column(name = "del_flag")
	@ApiModelProperty(value = "删除标识")
	@ExcelIgnore
	private String delFlag;

	/**
	 * 创建者id
	 */
	@Column(name = "create_by")
	@ApiModelProperty(value = "创建者id")
	@ExcelIgnore
	private String createBy;

	/**
	 * 创建者名称
	 */
	@Column(name = "creator")
	@ApiModelProperty(value = "创建者名称")
	@ExcelIgnore
	private String creator;

	/**
	 * 修改者id
	 */
	@Column(name = "update_by")
	@ApiModelProperty(value = "修改者id")
	@ExcelIgnore
	private String updateBy;

	/**
	 * 修改者名称
	 */
	@Column(name = "updater")
	@ApiModelProperty(value = "修改者名称")
	@ExcelIgnore
	private String updater;

	/**
	 * 创建时间
	 */
	@Column(name = "create_date")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	@ApiModelProperty(value = "创建时间")
	@ExcelIgnore
	private Date createDate;

	/**
	 * 更改时间
	 */
	@Column(name = "update_date")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	@ApiModelProperty(value = "更改时间")
	@ExcelIgnore
	private Date updateDate;


	@ApiModelProperty(value = "备注")
	@Length(max = 255, message = "{common.remark.length}")
	@ExcelIgnore
	private String remarks;

}
